home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_gdv.cpp < prev    next >
C/C++ Source or Header  |  1996-03-19  |  6KB  |  219 lines

  1. /**********************************************************************
  2. *
  3. *       GDV.CPP
  4. *
  5. *
  6. *       Summary:    Play a GDV file
  7. *
  8. *       Author:   Kevin Dudley / Tony Crowther / Graeme Ing
  9. *
  10. *       Project:  Normality Inc   PC
  11. *
  12. *       Dated:    1527995 Wednesday 27-9-1995 15:59.
  13. *
  14. **********************************************************************/
  15.  
  16. #include <iostream.h>
  17. #include <stdlib.h>
  18. #include <stdio.h>
  19. #include <graph.h>
  20. #include <i86.h>
  21. #include <dos.h>
  22. #include <conio.h>
  23. #include <float.h>
  24. #include <time.h>
  25. #include <math.h>
  26. #include <string.h>
  27.  
  28. #include "defines.h"
  29. #include "data.equ"
  30. #include "3deng.h"
  31. #include "menu.h"
  32. #include "video.h"
  33. #include "vesa.h"
  34. #include "unmangle.h"
  35. #include "memory.h"
  36. #include "gamedata.h"
  37.  
  38. #include "config.h"
  39. #include "sos.h"
  40. #include "timer.h"
  41. #include "digi.h"
  42. #include "midi.h"
  43.  
  44. #include "playdam.h"                            // Structure Definitions for Digital Video
  45. #include "playcall.h"                        // Call Defininitions for Digital Video
  46. #include "animlink.h"
  47. #include "calldef.h"
  48. #include "memstruc.h"
  49. #include "rothlink.h"
  50. #include "mallocx.h"
  51. #include "control.h"
  52.  
  53. #include "eurodefs.h"
  54. #include "euro_fxd.h"
  55. #include "euro.equ"
  56. #include "euro_sym.h"
  57. #include "euro_def.h"
  58. #include "euro_var.h"
  59. #include "euro_grf.h"
  60. #include "euro_dsk.h"
  61. #include "euro_fix.h"
  62. #include "euro_sel.h"
  63. #include "euro_inf.h"
  64. #include "euro_cnt.h"
  65. #include "euro_usr.h"
  66. #include "euro_net.h"
  67.  
  68. #define    GDV_MEM    512*1024
  69. #define GDV_ABORT                0x01
  70. #define GDV_LOOP                0x08
  71. #define DEFAULT_FADEIN        0
  72. #define DEFAULT_FADEOUT        0
  73. #define DEFAULT_DELAYEXIT    25
  74.  
  75. extern    "C"    volatile int count;
  76. extern    int    testVESA;
  77. extern    int     VESAmode(int *);
  78. extern    int    gdv_gran;
  79. extern     "C"     volatile char keys[256];
  80. extern         char    return_doskey;
  81. extern    BYTE         palette_buffer[];
  82. extern    BYTE         work_buffer[768];
  83.  
  84. extern    ModeInfoBlock *vmode_inf;
  85. char    out;
  86.  
  87.  
  88. BYTE    presents[]={
  89.       0x3F,0x33,0x00,0x3F,0x33,0x0C,0x3F,0x33,0x19,0x3F,0x3F,0x26,
  90.             };
  91.  
  92. //---------------------------------------------------
  93. long int GDVCallbackRoutine(long int mode,void *header,void *data,short int frame)
  94. //---------------------------------------------------
  95.  
  96. //********************************************************************************************************************************
  97. // Callback generated by GDV player.
  98. // Test for abort GDV.
  99. //********************************************************************************************************************************
  100.  
  101. {
  102. //    Get_mouse_data();                 // reads mouse data and erases last displayed mouse cursor.
  103. //
  104. //    StorePSEUDObuffer( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  105. //                MOUSE_STOREbuff, MouseXposn, MouseYposn );
  106. //    DrawIMAGE(  &FrontendPseudoDEFN, &FrontendTextureDEFN, MOUSEimages+NoButton, 
  107. //            MouseXposn, MouseYposn, NO_BOX, spritecopy );
  108. //    AddToDumpList( MouseXposn, MouseYposn, Image_Widths[MOUSEimages+NoButton], Image_Heights[MOUSEimages+NoButton]);
  109. //    CopyDumpListToScreen();                 
  110. //           DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, MOUSE_STOREbuff, 
  111. //            MouseXposn, MouseYposn, NO_BOX, straightcopy );
  112. //    AddToDumpList( MouseXposn, MouseYposn, Image_Widths[MOUSEimages+NoButton], Image_Heights[MOUSEimages+NoButton]);
  113. //
  114.  
  115.  
  116.     if (mode == CBM_LookForAbort && (keys[1]) )
  117.     {
  118.         ChangeMenu    = MAIN;
  119.         return(CBX_Abort);
  120.     }
  121.  
  122.     else
  123.         return(CBX_Normal);
  124. }
  125.  
  126. //********************************************************************************************************************************
  127.  
  128. void PlayGDV()
  129. {
  130.     
  131.  
  132.     char    file[128]; 
  133.     unsigned char *mem;
  134.     unsigned long int Error;
  135.     _PlayAnimBlock PlayBlock = { 0 };
  136.  
  137.     mem=(unsigned char *)mallocx(GDV_MEM);        // allocate mem for player
  138.  
  139.     if (mem == 0)
  140.          return;
  141.     memset( mem, 0, GDV_MEM );
  142.  
  143.     strcpy    (file, EuroGDVfile);
  144.  
  145.     PlayBlock.FileName     =     &file[0];
  146.     PlayBlock.Flags        =     NULL;
  147.     PlayBlock.Screen    =     0x110;
  148.     PlayBlock.ScreenXSize    =     640;
  149.     PlayBlock.ScreenYSize    =     480;
  150.           PlayBlock.ScreenGran    =    0;   
  151.  
  152.           if (SoundCard==0)
  153.               PlayBlock.Flags|=    PAF_NoAudio;
  154.  
  155.         PlayBlock.CallBack = &GDVCallbackRoutine;
  156.           PlayBlock.DrvPath="DIGI\\";
  157.     PlayBlock.MemBlock=mem;
  158.     PlayBlock.MemBlockSize=GDV_MEM;
  159.     
  160.     if (SoundCard==0)
  161.         PlayBlock.Flags|=     PAF_NoAudio;
  162.     else
  163.         PlayBlock.DIGIHandle_SOS=DIGIDriverHandle;
  164.  
  165.     PlayBlock.DriveCap_SOS=&DIGICapabilities;
  166.     PlayBlock.SNDID=SoundCard;
  167.     PlayBlock.SNDPort=SoundPort;
  168.     PlayBlock.SNDIRQ=SoundIRQ;
  169.     PlayBlock.SNDDMA=SoundDMA;
  170.     PlayBlock.SNDPara=0;
  171.  
  172.  
  173.     if(!(Error=InitAnim(&PlayBlock)))
  174.     {
  175.         Error=StartAnim(&PlayBlock);
  176.         CloseAnim(&PlayBlock);
  177.     }
  178.  
  179.     freex(mem);
  180. }
  181.  
  182. //********************************************************************************************************************************
  183. //         PlaySample routines to link with Tony's ROTH sample stuff!
  184. //********************************************************************************************************************************
  185.  
  186. extern WORD PlaySample (_SOS_START_SAMPLE *mysample, void (far cdecl*callback)(WORD,WORD,WORD))
  187. {
  188.     mysample->lpCallback=(void cdecl (far*)(WORD,WORD,WORD))callback;
  189.    return (sosDIGIStartSample( DIGIDriverHandle, mysample));
  190. } /* PlaySample */
  191.  
  192.  
  193. extern WORD StopPlaySample (WORD handle)
  194. {
  195.    return (sosDIGIStopSample( DIGIDriverHandle, handle));
  196. }
  197.  
  198. extern WORD ChangeSampleVol (WORD handle,int vol)
  199. {
  200.    return (sosDIGISetSampleVolume( DIGIDriverHandle, handle,vol));
  201. }
  202.  
  203. extern WORD ChangeSamplePan (WORD handle,int pan)
  204. {
  205.    return (sosDIGISetPanLocation( DIGIDriverHandle, handle,pan));
  206. }
  207.  
  208.  
  209.  
  210. //********************************************************************************************************************************
  211.  
  212. void    DoStadiumFlythru( char MENU )
  213.     {
  214.         if ( MENU == VENUE_FLYTHRU && LogicState == RUN_FRONTEND)
  215.             PlayGDV();
  216.     }
  217.  
  218. //********************************************************************************************************************************
  219.